package
        com.zzc.fee.service.impl;

import com.alibaba.nacos.api.cmdb.spi.CmdbService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hos.entity.his.CareOrderItem;
import com.hos.entity.stock.Medicines;
import com.zzc.fee.mapper.CareOrderItemMapper;
import com.zzc.fee.service.CareOrderItemService;
import com.zzc.fee.vo.CareOrderItemVo;
import org.apache.catalina.util.CharsetMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * @author：xIAO_ZHOU_TX
 * @date：Created in 2023/12/22 9:37
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class CareOrderItemServiceImpl implements CareOrderItemService {
    @Resource
    private CareOrderItemMapper careOrderItemMapper;
    @Override
    public List<CareOrderItem> queryCheck(CareOrderItemVo careOrderItemVo) {
        LambdaQueryWrapper<CareOrderItem> wrapper =new LambdaQueryWrapper<>();
        wrapper.eq(CareOrderItem::getStatus,"3")//状态  完成支付
                .eq(CareOrderItem::getItemType,"0");//项目类型 药品/检查项目
        //药品名称
        if(StringUtils.hasText(careOrderItemVo.getItemName())){
                        wrapper.like(CareOrderItem::getItemName,careOrderItemVo.getItemName());
        }
        //交易时间
        if (Objects.nonNull(careOrderItemVo.getDateRange())) {
            wrapper.between(CareOrderItem::getCreateTime, careOrderItemVo.getDateRange()[0], careOrderItemVo.getDateRange()[1]);
        }
        return careOrderItemMapper.selectList(wrapper);
    }

    @Override
    public List<CareOrderItem> queryDrugStat(CareOrderItemVo careOrderItemVo) {
        return careOrderItemMapper.queryWorkload(careOrderItemVo.getItemName(), careOrderItemVo.getDateRange());
    }


}